-
-
Notifications
You must be signed in to change notification settings - Fork 657
fix some wrong syntax #40747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix some wrong syntax #40747
Conversation
Documentation preview for this PR (built with commit 07ed645; changes) is ready! 🎉 |
@@ -11258,7 +11258,7 @@ def is_equivalent(self, other): | |||
False | |||
""" | |||
A = self.minimization().relabeled() | |||
[initial] = A.initial_states() | |||
initial, = A.initial_states() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure it's the correct syntax ?
sage: a, = [2, 3]
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[1], line 1
----> 1 a, = [Integer(2), Integer(3)]
ValueError: too many values to unpack (expected 1)
sage: a, *_ = [2, 3]
sage: a
2
sage: a, *_ = [2, 3, 4]
sage: a
2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it works to unpack a list or tuple with one element
sage: moulinsart, = [421]
@@ -680,7 +680,7 @@ def representation_matrix_for_simple_transposition(self, i): | |||
M = matrix(self._ring, digraph.num_verts()) | |||
for g in digraph.connected_components_subgraphs(): | |||
if g.num_verts() == 1: | |||
[v] = g.vertices(sort=True) | |||
v, = g.vertices(sort=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question here. may be you can use v = g.vertices(sort=True)[0]
@@ -2460,7 +2460,7 @@ def bridges(G, labels=True): | |||
if len(b) == 2 and not tuple(b) in ME: | |||
if labels: | |||
if multiple_edges: | |||
[label] = G.edge_label(b[0], b[1]) | |||
label, = G.edge_label(b[0], b[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here again
@@ -1548,7 +1548,7 @@ cdef class TreelengthConnected: | |||
cdef frozenset reduced_cut | |||
|
|||
if len(cc) == 1: | |||
[v] = cc | |||
v, = cc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v = cc[0]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
found using
`
gg "^\s*[[a-zA-Z0-9, ]*] = " src/sage/
`
📝 Checklist